Ext.define('DragonApp.view.property.StatusBarController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.propertystatusbar',

    onBarRender: function() {
        var propertyform = Ext.ComponentQuery.query('propertyform')[0];
        var textArea = propertyform.down('htmleditor');
        var charCount = this.lookupReference('charCount'),
            event = Ext.isOpera ? 'keypress' : 'keydown';

        textArea.on(event, function(comp) {
            var v = comp.getValue(),
                cc = v.length ? v.length : 0;
            charCount.update('Chars: ' + cc);
        }, null, { buffer: 1 });
    }
});